﻿using System.Configuration;
using System.Threading.Tasks;
using System.Web.Http;

namespace Web.API._471.Controllers
{
    [Route("api/[controller]/[action]")]
    public class ApolloController : ApiController
    {
        [HttpGet]
        [Route("api/Apollo/Section/{key}")]
        public async Task<string> Section(string key)
        {
            var config = WebApiApplication.Configuration;

            if (string.IsNullOrEmpty(key))
                return await Task.FromResult<string>(null);
            var value = config[key];
            var value2 = ConfigurationManager.AppSettings[key];

            return await Task.FromResult($"{nameof(key)}:{key},Configuration[key].value:{value},AppSetting[key].value:{value2}");
        }
    }
}
